package com.stx.mapper;

import com.stx.domain.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UserMapper {
    //@Select("select * from user")
    List<User> findAll();
    //删除
    //@Delete("delete  from user where id  = #{id}")
    void delUser(int id);
    //新增
   // @Insert("insert into user values (#{id},#{username},#{pass},#{curent_date})")
    void addUser(User user);
    //修改
   // @Update("update user set username = #{username},pass= #{pass},curent_date =#{curent_date}\n" +
    //        "        where id = #{id}")
    void updateUser(User user);
    // 模糊查询
 /*   @Select("<script>"+"select * from user\n" +
            "        <where>\n" +
            "            <if test=\"id!=0\">\n" +
            "                and id=#{id}\n" +
            "            </if>\n" +
            "            <if test=\"username!=null\">\n" +
            "                and username=#{username}\n" +
            "            </if>\n" +
            "        </where>"+"</script>")*/
    List<User> findByCondition(User u);
}
